3.2.65 \(\int (a+b \log (c x^n))^2 (d+e \log (f x^r)) \, dx\) [165]

3.2.65.1 Optimal result
3.2.65.2 Mathematica [A] (verified)
3.2.65.3 Rubi [A] (verified)
3.2.65.4 Maple [A] (verified)
3.2.65.5 Fricas [B] (verification not implemented)
3.2.65.6 Sympy [A] (verification not implemented)
3.2.65.7 Maxima [A] (verification not implemented)
3.2.65.8 Giac [B] (verification not implemented)
3.2.65.9 Mupad [B] (verification not implemented)

3.2.65.1 Optimal result

Integrand size = 23, antiderivative size = 147 \[ \int \left (a+b \log \left (c x^n\right )\right )^2 \left (d+e \log \left (f x^r\right )\right ) \, dx=2 a b e n r x-4 b^2 e n^2 r x+2 b e n (a-b n) r x+4 b^2 e n r x \log \left (c x^n\right )-e r x \left (a+b \log \left (c x^n\right )\right )^2-2 a b n x \left (d+e \log \left (f x^r\right )\right )+2 b^2 n^2 x \left (d+e \log \left (f x^r\right )\right )-2 b^2 n x \log \left (c x^n\right ) \left (d+e \log \left (f x^r\right )\right )+x \left (a+b \log \left (c x^n\right )\right )^2 \left (d+e \log \left (f x^r\right )\right ) \]

output
2*a*b*e*n*r*x-4*b^2*e*n^2*r*x+2*b*e*n*(-b*n+a)*r*x+4*b^2*e*n*r*x*ln(c*x^n) 
-e*r*x*(a+b*ln(c*x^n))^2-2*a*b*n*x*(d+e*ln(f*x^r))+2*b^2*n^2*x*(d+e*ln(f*x 
^r))-2*b^2*n*x*ln(c*x^n)*(d+e*ln(f*x^r))+x*(a+b*ln(c*x^n))^2*(d+e*ln(f*x^r 
))
 
3.2.65.2 Mathematica [A] (verified)

Time = 0.08 (sec) , antiderivative size = 141, normalized size of antiderivative = 0.96 \[ \int \left (a+b \log \left (c x^n\right )\right )^2 \left (d+e \log \left (f x^r\right )\right ) \, dx=x \left (a^2 d-2 a b d n+2 b^2 d n^2-a^2 e r+4 a b e n r-6 b^2 e n^2 r+e \left (a^2-2 a b n+2 b^2 n^2\right ) \log \left (f x^r\right )+b^2 \log ^2\left (c x^n\right ) \left (d-e r+e \log \left (f x^r\right )\right )+2 b \log \left (c x^n\right ) \left (a d-b d n-a e r+2 b e n r+e (a-b n) \log \left (f x^r\right )\right )\right ) \]

input
Integrate[(a + b*Log[c*x^n])^2*(d + e*Log[f*x^r]),x]
 
output
x*(a^2*d - 2*a*b*d*n + 2*b^2*d*n^2 - a^2*e*r + 4*a*b*e*n*r - 6*b^2*e*n^2*r 
 + e*(a^2 - 2*a*b*n + 2*b^2*n^2)*Log[f*x^r] + b^2*Log[c*x^n]^2*(d - e*r + 
e*Log[f*x^r]) + 2*b*Log[c*x^n]*(a*d - b*d*n - a*e*r + 2*b*e*n*r + e*(a - b 
*n)*Log[f*x^r]))
 
3.2.65.3 Rubi [A] (verified)

Time = 0.31 (sec) , antiderivative size = 141, normalized size of antiderivative = 0.96, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.087, Rules used = {2808, 2009}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \left (a+b \log \left (c x^n\right )\right )^2 \left (d+e \log \left (f x^r\right )\right ) \, dx\)

\(\Big \downarrow \) 2808

\(\displaystyle -e r \int \left (-2 n \log \left (c x^n\right ) b^2-2 n (a-b n) b+\left (a+b \log \left (c x^n\right )\right )^2\right )dx+x \left (a+b \log \left (c x^n\right )\right )^2 \left (d+e \log \left (f x^r\right )\right )-2 a b n x \left (d+e \log \left (f x^r\right )\right )-2 b^2 n x \log \left (c x^n\right ) \left (d+e \log \left (f x^r\right )\right )+2 b^2 n^2 x \left (d+e \log \left (f x^r\right )\right )\)

\(\Big \downarrow \) 2009

\(\displaystyle -e r \left (x \left (a+b \log \left (c x^n\right )\right )^2-2 a b n x-2 b n x (a-b n)-4 b^2 n x \log \left (c x^n\right )+4 b^2 n^2 x\right )+x \left (a+b \log \left (c x^n\right )\right )^2 \left (d+e \log \left (f x^r\right )\right )-2 a b n x \left (d+e \log \left (f x^r\right )\right )-2 b^2 n x \log \left (c x^n\right ) \left (d+e \log \left (f x^r\right )\right )+2 b^2 n^2 x \left (d+e \log \left (f x^r\right )\right )\)

input
Int[(a + b*Log[c*x^n])^2*(d + e*Log[f*x^r]),x]
 
output
-(e*r*(-2*a*b*n*x + 4*b^2*n^2*x - 2*b*n*(a - b*n)*x - 4*b^2*n*x*Log[c*x^n] 
 + x*(a + b*Log[c*x^n])^2)) - 2*a*b*n*x*(d + e*Log[f*x^r]) + 2*b^2*n^2*x*( 
d + e*Log[f*x^r]) - 2*b^2*n*x*Log[c*x^n]*(d + e*Log[f*x^r]) + x*(a + b*Log 
[c*x^n])^2*(d + e*Log[f*x^r])
 

3.2.65.3.1 Defintions of rubi rules used

rule 2009
Int[u_, x_Symbol] :> Simp[IntSum[u, x], x] /; SumQ[u]
 

rule 2808
Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))^(p_.)*((d_.) + Log[(f_.)*(x_)^(r_ 
.)]*(e_.)), x_Symbol] :> With[{u = IntHide[(a + b*Log[c*x^n])^p, x]}, Simp[ 
(d + e*Log[f*x^r])   u, x] - Simp[e*r   Int[SimplifyIntegrand[u/x, x], x], 
x]] /; FreeQ[{a, b, c, d, e, f, n, p, r}, x]
 
3.2.65.4 Maple [A] (verified)

Time = 7.75 (sec) , antiderivative size = 281, normalized size of antiderivative = 1.91

method result size
parallelrisch \(-\frac {-2 x \ln \left (c \,x^{n}\right ) \ln \left (f \,x^{r}\right ) a b e \,n^{7}+2 x \ln \left (c \,x^{n}\right ) a b e \,n^{7} r -2 x \,b^{2} d \,n^{9}-x \,a^{2} d \,n^{7}-e \,b^{2} \ln \left (f \,x^{r}\right ) \ln \left (c \,x^{n}\right )^{2} x \,n^{7}+2 x \ln \left (c \,x^{n}\right ) \ln \left (f \,x^{r}\right ) b^{2} e \,n^{8}+2 x \ln \left (f \,x^{r}\right ) a b e \,n^{8}-4 x \ln \left (c \,x^{n}\right ) b^{2} e \,n^{8} r -2 x \ln \left (c \,x^{n}\right ) a b d \,n^{7}+x \ln \left (c \,x^{n}\right )^{2} b^{2} e \,n^{7} r -4 x a b e \,n^{8} r -2 x \ln \left (f \,x^{r}\right ) b^{2} e \,n^{9}-x \ln \left (f \,x^{r}\right ) a^{2} e \,n^{7}+2 x \ln \left (c \,x^{n}\right ) b^{2} d \,n^{8}-x \ln \left (c \,x^{n}\right )^{2} b^{2} d \,n^{7}+6 x \,b^{2} e \,n^{9} r +x \,a^{2} e \,n^{7} r +2 x a b d \,n^{8}}{n^{7}}\) \(281\)
risch \(\text {Expression too large to display}\) \(8701\)

input
int((a+b*ln(c*x^n))^2*(d+e*ln(f*x^r)),x,method=_RETURNVERBOSE)
 
output
-(-2*x*ln(c*x^n)*ln(f*x^r)*a*b*e*n^7+2*x*ln(c*x^n)*a*b*e*n^7*r-2*x*b^2*d*n 
^9-x*a^2*d*n^7-e*b^2*ln(f*x^r)*ln(c*x^n)^2*x*n^7+2*x*ln(c*x^n)*ln(f*x^r)*b 
^2*e*n^8+2*x*ln(f*x^r)*a*b*e*n^8-4*x*ln(c*x^n)*b^2*e*n^8*r-2*x*ln(c*x^n)*a 
*b*d*n^7+x*ln(c*x^n)^2*b^2*e*n^7*r-4*x*a*b*e*n^8*r-2*x*ln(f*x^r)*b^2*e*n^9 
-x*ln(f*x^r)*a^2*e*n^7+2*x*ln(c*x^n)*b^2*d*n^8-x*ln(c*x^n)^2*b^2*d*n^7+6*x 
*b^2*e*n^9*r+x*a^2*e*n^7*r+2*x*a*b*d*n^8)/n^7
 
3.2.65.5 Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 345 vs. \(2 (148) = 296\).

Time = 0.30 (sec) , antiderivative size = 345, normalized size of antiderivative = 2.35 \[ \int \left (a+b \log \left (c x^n\right )\right )^2 \left (d+e \log \left (f x^r\right )\right ) \, dx=b^{2} e n^{2} r x \log \left (x\right )^{3} - {\left (b^{2} e r - b^{2} d\right )} x \log \left (c\right )^{2} - 2 \, {\left (b^{2} d n - a b d - {\left (2 \, b^{2} e n - a b e\right )} r\right )} x \log \left (c\right ) + {\left (2 \, b^{2} e n r x \log \left (c\right ) + b^{2} e n^{2} x \log \left (f\right ) + {\left (b^{2} d n^{2} - {\left (3 \, b^{2} e n^{2} - 2 \, a b e n\right )} r\right )} x\right )} \log \left (x\right )^{2} + {\left (2 \, b^{2} d n^{2} - 2 \, a b d n + a^{2} d - {\left (6 \, b^{2} e n^{2} - 4 \, a b e n + a^{2} e\right )} r\right )} x + {\left (b^{2} e x \log \left (c\right )^{2} - 2 \, {\left (b^{2} e n - a b e\right )} x \log \left (c\right ) + {\left (2 \, b^{2} e n^{2} - 2 \, a b e n + a^{2} e\right )} x\right )} \log \left (f\right ) + {\left (b^{2} e r x \log \left (c\right )^{2} + 2 \, {\left (b^{2} d n - {\left (2 \, b^{2} e n - a b e\right )} r\right )} x \log \left (c\right ) - {\left (2 \, b^{2} d n^{2} - 2 \, a b d n - {\left (6 \, b^{2} e n^{2} - 4 \, a b e n + a^{2} e\right )} r\right )} x + 2 \, {\left (b^{2} e n x \log \left (c\right ) - {\left (b^{2} e n^{2} - a b e n\right )} x\right )} \log \left (f\right )\right )} \log \left (x\right ) \]

input
integrate((a+b*log(c*x^n))^2*(d+e*log(f*x^r)),x, algorithm="fricas")
 
output
b^2*e*n^2*r*x*log(x)^3 - (b^2*e*r - b^2*d)*x*log(c)^2 - 2*(b^2*d*n - a*b*d 
 - (2*b^2*e*n - a*b*e)*r)*x*log(c) + (2*b^2*e*n*r*x*log(c) + b^2*e*n^2*x*l 
og(f) + (b^2*d*n^2 - (3*b^2*e*n^2 - 2*a*b*e*n)*r)*x)*log(x)^2 + (2*b^2*d*n 
^2 - 2*a*b*d*n + a^2*d - (6*b^2*e*n^2 - 4*a*b*e*n + a^2*e)*r)*x + (b^2*e*x 
*log(c)^2 - 2*(b^2*e*n - a*b*e)*x*log(c) + (2*b^2*e*n^2 - 2*a*b*e*n + a^2* 
e)*x)*log(f) + (b^2*e*r*x*log(c)^2 + 2*(b^2*d*n - (2*b^2*e*n - a*b*e)*r)*x 
*log(c) - (2*b^2*d*n^2 - 2*a*b*d*n - (6*b^2*e*n^2 - 4*a*b*e*n + a^2*e)*r)* 
x + 2*(b^2*e*n*x*log(c) - (b^2*e*n^2 - a*b*e*n)*x)*log(f))*log(x)
 
3.2.65.6 Sympy [A] (verification not implemented)

Time = 0.78 (sec) , antiderivative size = 279, normalized size of antiderivative = 1.90 \[ \int \left (a+b \log \left (c x^n\right )\right )^2 \left (d+e \log \left (f x^r\right )\right ) \, dx=a^{2} d x - a^{2} e r x + a^{2} e x \log {\left (f x^{r} \right )} - 2 a b d n x + 2 a b d x \log {\left (c x^{n} \right )} + 4 a b e n r x - 2 a b e n x \log {\left (f x^{r} \right )} - 2 a b e r x \log {\left (c x^{n} \right )} + 2 a b e x \log {\left (c x^{n} \right )} \log {\left (f x^{r} \right )} + 2 b^{2} d n^{2} x - 2 b^{2} d n x \log {\left (c x^{n} \right )} + b^{2} d x \log {\left (c x^{n} \right )}^{2} - 6 b^{2} e n^{2} r x + 2 b^{2} e n^{2} x \log {\left (f x^{r} \right )} + 4 b^{2} e n r x \log {\left (c x^{n} \right )} - 2 b^{2} e n x \log {\left (c x^{n} \right )} \log {\left (f x^{r} \right )} - b^{2} e r x \log {\left (c x^{n} \right )}^{2} + b^{2} e x \log {\left (c x^{n} \right )}^{2} \log {\left (f x^{r} \right )} \]

input
integrate((a+b*ln(c*x**n))**2*(d+e*ln(f*x**r)),x)
 
output
a**2*d*x - a**2*e*r*x + a**2*e*x*log(f*x**r) - 2*a*b*d*n*x + 2*a*b*d*x*log 
(c*x**n) + 4*a*b*e*n*r*x - 2*a*b*e*n*x*log(f*x**r) - 2*a*b*e*r*x*log(c*x** 
n) + 2*a*b*e*x*log(c*x**n)*log(f*x**r) + 2*b**2*d*n**2*x - 2*b**2*d*n*x*lo 
g(c*x**n) + b**2*d*x*log(c*x**n)**2 - 6*b**2*e*n**2*r*x + 2*b**2*e*n**2*x* 
log(f*x**r) + 4*b**2*e*n*r*x*log(c*x**n) - 2*b**2*e*n*x*log(c*x**n)*log(f* 
x**r) - b**2*e*r*x*log(c*x**n)**2 + b**2*e*x*log(c*x**n)**2*log(f*x**r)
 
3.2.65.7 Maxima [A] (verification not implemented)

Time = 0.21 (sec) , antiderivative size = 213, normalized size of antiderivative = 1.45 \[ \int \left (a+b \log \left (c x^n\right )\right )^2 \left (d+e \log \left (f x^r\right )\right ) \, dx=-{\left (r x - x \log \left (f x^{r}\right )\right )} b^{2} e \log \left (c x^{n}\right )^{2} + b^{2} d x \log \left (c x^{n}\right )^{2} + 2 \, {\left ({\left (2 \, r - \log \left (f\right )\right )} x - x \log \left (x^{r}\right )\right )} a b e n - 2 \, a b d n x - a^{2} e r x - 2 \, {\left (r x - x \log \left (f x^{r}\right )\right )} a b e \log \left (c x^{n}\right ) + 2 \, a b d x \log \left (c x^{n}\right ) + a^{2} e x \log \left (f x^{r}\right ) + 2 \, {\left (n^{2} x - n x \log \left (c x^{n}\right )\right )} b^{2} d - 2 \, {\left ({\left ({\left (3 \, r - \log \left (f\right )\right )} x - x \log \left (x^{r}\right )\right )} n^{2} - {\left ({\left (2 \, r - \log \left (f\right )\right )} x - x \log \left (x^{r}\right )\right )} n \log \left (c x^{n}\right )\right )} b^{2} e + a^{2} d x \]

input
integrate((a+b*log(c*x^n))^2*(d+e*log(f*x^r)),x, algorithm="maxima")
 
output
-(r*x - x*log(f*x^r))*b^2*e*log(c*x^n)^2 + b^2*d*x*log(c*x^n)^2 + 2*((2*r 
- log(f))*x - x*log(x^r))*a*b*e*n - 2*a*b*d*n*x - a^2*e*r*x - 2*(r*x - x*l 
og(f*x^r))*a*b*e*log(c*x^n) + 2*a*b*d*x*log(c*x^n) + a^2*e*x*log(f*x^r) + 
2*(n^2*x - n*x*log(c*x^n))*b^2*d - 2*(((3*r - log(f))*x - x*log(x^r))*n^2 
- ((2*r - log(f))*x - x*log(x^r))*n*log(c*x^n))*b^2*e + a^2*d*x
 
3.2.65.8 Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 399 vs. \(2 (148) = 296\).

Time = 0.30 (sec) , antiderivative size = 399, normalized size of antiderivative = 2.71 \[ \int \left (a+b \log \left (c x^n\right )\right )^2 \left (d+e \log \left (f x^r\right )\right ) \, dx=b^{2} e n^{2} r x \log \left (x\right )^{3} - 3 \, b^{2} e n^{2} r x \log \left (x\right )^{2} + 2 \, b^{2} e n r x \log \left (c\right ) \log \left (x\right )^{2} + b^{2} e n^{2} x \log \left (f\right ) \log \left (x\right )^{2} + 6 \, b^{2} e n^{2} r x \log \left (x\right ) - 4 \, b^{2} e n r x \log \left (c\right ) \log \left (x\right ) + b^{2} e r x \log \left (c\right )^{2} \log \left (x\right ) - 2 \, b^{2} e n^{2} x \log \left (f\right ) \log \left (x\right ) + 2 \, b^{2} e n x \log \left (c\right ) \log \left (f\right ) \log \left (x\right ) + b^{2} d n^{2} x \log \left (x\right )^{2} + 2 \, a b e n r x \log \left (x\right )^{2} - 6 \, b^{2} e n^{2} r x + 4 \, b^{2} e n r x \log \left (c\right ) - b^{2} e r x \log \left (c\right )^{2} + 2 \, b^{2} e n^{2} x \log \left (f\right ) - 2 \, b^{2} e n x \log \left (c\right ) \log \left (f\right ) + b^{2} e x \log \left (c\right )^{2} \log \left (f\right ) - 2 \, b^{2} d n^{2} x \log \left (x\right ) - 4 \, a b e n r x \log \left (x\right ) + 2 \, b^{2} d n x \log \left (c\right ) \log \left (x\right ) + 2 \, a b e r x \log \left (c\right ) \log \left (x\right ) + 2 \, a b e n x \log \left (f\right ) \log \left (x\right ) + 2 \, b^{2} d n^{2} x + 4 \, a b e n r x - 2 \, b^{2} d n x \log \left (c\right ) - 2 \, a b e r x \log \left (c\right ) + b^{2} d x \log \left (c\right )^{2} - 2 \, a b e n x \log \left (f\right ) + 2 \, a b e x \log \left (c\right ) \log \left (f\right ) + 2 \, a b d n x \log \left (x\right ) + a^{2} e r x \log \left (x\right ) - 2 \, a b d n x - a^{2} e r x + 2 \, a b d x \log \left (c\right ) + a^{2} e x \log \left (f\right ) + a^{2} d x \]

input
integrate((a+b*log(c*x^n))^2*(d+e*log(f*x^r)),x, algorithm="giac")
 
output
b^2*e*n^2*r*x*log(x)^3 - 3*b^2*e*n^2*r*x*log(x)^2 + 2*b^2*e*n*r*x*log(c)*l 
og(x)^2 + b^2*e*n^2*x*log(f)*log(x)^2 + 6*b^2*e*n^2*r*x*log(x) - 4*b^2*e*n 
*r*x*log(c)*log(x) + b^2*e*r*x*log(c)^2*log(x) - 2*b^2*e*n^2*x*log(f)*log( 
x) + 2*b^2*e*n*x*log(c)*log(f)*log(x) + b^2*d*n^2*x*log(x)^2 + 2*a*b*e*n*r 
*x*log(x)^2 - 6*b^2*e*n^2*r*x + 4*b^2*e*n*r*x*log(c) - b^2*e*r*x*log(c)^2 
+ 2*b^2*e*n^2*x*log(f) - 2*b^2*e*n*x*log(c)*log(f) + b^2*e*x*log(c)^2*log( 
f) - 2*b^2*d*n^2*x*log(x) - 4*a*b*e*n*r*x*log(x) + 2*b^2*d*n*x*log(c)*log( 
x) + 2*a*b*e*r*x*log(c)*log(x) + 2*a*b*e*n*x*log(f)*log(x) + 2*b^2*d*n^2*x 
 + 4*a*b*e*n*r*x - 2*b^2*d*n*x*log(c) - 2*a*b*e*r*x*log(c) + b^2*d*x*log(c 
)^2 - 2*a*b*e*n*x*log(f) + 2*a*b*e*x*log(c)*log(f) + 2*a*b*d*n*x*log(x) + 
a^2*e*r*x*log(x) - 2*a*b*d*n*x - a^2*e*r*x + 2*a*b*d*x*log(c) + a^2*e*x*lo 
g(f) + a^2*d*x
 
3.2.65.9 Mupad [B] (verification not implemented)

Time = 0.70 (sec) , antiderivative size = 165, normalized size of antiderivative = 1.12 \[ \int \left (a+b \log \left (c x^n\right )\right )^2 \left (d+e \log \left (f x^r\right )\right ) \, dx=x\,\left (a^2\,d+2\,b^2\,d\,n^2-a^2\,e\,r-6\,b^2\,e\,n^2\,r-2\,a\,b\,d\,n+4\,a\,b\,e\,n\,r\right )+\ln \left (f\,x^r\right )\,\left (a^2\,e\,x-\ln \left (c\,x^n\right )\,\left (2\,b^2\,e\,n\,x-2\,a\,b\,e\,x\right )+2\,b^2\,e\,n^2\,x+b^2\,e\,x\,{\ln \left (c\,x^n\right )}^2-2\,a\,b\,e\,n\,x\right )+2\,b\,x\,\ln \left (c\,x^n\right )\,\left (a\,d-b\,d\,n-a\,e\,r+2\,b\,e\,n\,r\right )+b^2\,x\,{\ln \left (c\,x^n\right )}^2\,\left (d-e\,r\right ) \]

input
int((d + e*log(f*x^r))*(a + b*log(c*x^n))^2,x)
 
output
x*(a^2*d + 2*b^2*d*n^2 - a^2*e*r - 6*b^2*e*n^2*r - 2*a*b*d*n + 4*a*b*e*n*r 
) + log(f*x^r)*(a^2*e*x - log(c*x^n)*(2*b^2*e*n*x - 2*a*b*e*x) + 2*b^2*e*n 
^2*x + b^2*e*x*log(c*x^n)^2 - 2*a*b*e*n*x) + 2*b*x*log(c*x^n)*(a*d - b*d*n 
 - a*e*r + 2*b*e*n*r) + b^2*x*log(c*x^n)^2*(d - e*r)